package cn.zhc.com.utils;

import android.content.Context;
import android.view.Gravity;
import android.widget.Toast;

/**
 * Created by zhouhongchun on 2017/8/14.
 */

public class UtilsToast {
    private static Toast mToast;
    private static String NET_ERRO = "请检查网络后重试!";
    public static void showNetError(Context mContext){
        if (mToast == null){
            mToast = Toast.makeText(mContext,NET_ERRO, Toast.LENGTH_SHORT);
        }
        mToast.setText(NET_ERRO);
        mToast.show();
    }
    public static void showToast(Context mContext,String text){
        if (mToast == null){
            mToast = Toast.makeText(mContext,text, Toast.LENGTH_SHORT);
            mToast.setGravity(Gravity.CENTER, 0, 0);
        }
        mToast.setText(text);
        mToast.show();
    }

    public static void hideToast(){
        if (mToast != null){
            mToast.cancel();
        }

    }

}
